package cn.hznc.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import lombok.Getter;
import lombok.Setter;

import java.util.List;
import java.util.Objects;

/**
 * @Author：Administrator
 * @Date：2023/9/18 21:55
 */
@Getter
@Setter
@Table(name = "t_machine_tool_program")
@TableName(value = "t_machine_tool_program")
public class MachineToolProgramEntity{

    /**
     * 主键
     */
    @Column(name = "id",type = MySqlTypeConstant.INT,length = 11,isKey = true,isAutoIncrement = true)
    @TableId(type = IdType.AUTO)
    private Integer id;


    /**
     * 物料编码
     */
    @Column(name = "partno",type = MySqlTypeConstant.VARCHAR,length = 50)
    @TableField("partno")
    private String partno;

    /**
     * 对应程序
     */
    @Column(name = "program",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField("program")
    private String program;

    /**
     * 机床名字
     */
    @TableField(exist = false)
    private List<String> machineToolName;

    /**
     * 机床id
     */
    @Column(name = "machine_tool_ids",type = MySqlTypeConstant.VARCHAR,length = 100)
    @TableField("machine_tool_ids")
    private String machineToolIds;


    @TableField(exist = false)
    private Integer count;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MachineToolProgramEntity that = (MachineToolProgramEntity) o;

        return Objects.equals(machineToolIds, that.machineToolIds);
    }

    @Override
    public int hashCode() {
        return machineToolIds != null ? machineToolIds.hashCode() : 0;
    }
}

